#Using Python Imaging Library - draw a bar graph of a given list of values
from PIL import Image, ImageDraw, ImageFont

def draw_graph(img,values):
	(scale_x, scale_y) = img.size
	#scale_y -= 20 #provide padding at top and bottom
	draw = ImageDraw.Draw(img)
	maxval = max(values)
	
	count = 1
	for v in values:
		draw.rectangle((20*count+5,scale_y,20*count+20,int(scale_y-scale_y*(v/maxval))),fill=(0,0,255))
		count += 1

img = Image.new("RGB",(400,400),(0,0,0))
values = [20.,30.,5.,100.]
draw_graph(img,values)
img.save('test.jpg','PNG')